//
//  CAISystemConfigManager.h
//  CAISystemConfigManager_Example
//
//  Created by 程杰 on 2021/11/1.
//  Copyright © 2021 cj. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef void( ^ SystemConfigSuccessBlock)(NSDictionary *systemConfigDic);
typedef void( ^ SystemConfigListSuccessBlock)(NSArray *systemConfigArray);
typedef void( ^ SystemConfigFailureBlock)(NSError * error);

@interface CAISystemConfigManager : NSObject

@property (nonatomic,strong) NSMutableDictionary *systemDefaultConfigMap;

+ (instancetype)shareInstance;

//启动应用配置库
-(void)launchSystemConfig:(BOOL)isLogin SuccessBlock:(SystemConfigSuccessBlock)successBlock
             failureBlock:(SystemConfigFailureBlock)failureBlock;

//获取本地单个系统参数
//key:系统参数key
-(NSString *)getLocalConfigByKey:(NSString *)key;

//获取本地系统参数集合
//keyMutableArray:系统参数集合
-(NSDictionary *)getLocalConfigByKeys:(NSMutableArray *)keyMutableArray;

//获取即时系统配置(根据对应key获取配置)
//keyMutableArray:key对应的数组，@[@{@"moduleName":@"default",@"key":@[@"value1",@"value2"]}]
//successBlock:成功回调
//failureBlock:失败回调
//返回值为传入数组中key对应的NSMutableDictionary
-(void)getInstantConfigKeys:(NSMutableArray *)keyMutableArray SuccessBlock:(_Nullable SystemConfigSuccessBlock)successBlock
                    failureBlock:(_Nullable SystemConfigFailureBlock)failureBlock;


// 获取公共key(无需登录)
//keyMutableArray:key对应的数组，@[@{@"moduleName":@"default",@"key":@[@"value1",@"value2"]}]
//successBlock:成功回调
//failureBlock:失败回调
-(void)getInstantPubKeys:(NSArray *)keyArray SuccessBlock:(_Nullable SystemConfigSuccessBlock)successBlock
            failureBlock:(_Nullable SystemConfigFailureBlock)failureBlock;

////根据模块获取对应配置
////module:模块名称
////successBlock:成功回调
////failureBlock:失败回调
//-(void)requestSystemConfigModule:(NSString *)module SuccessBlock:(SystemConfigSuccessBlock)successBlock
//                    failureBlock:(SystemConfigFailureBlock)failureBlock;

//获取全量系统参数
-(void)getAllConfigSuccessBlock:(_Nullable SystemConfigSuccessBlock)successBlock
                   failureBlock:(_Nullable SystemConfigFailureBlock)failureBlock;

//获取全量系统参数(本地json+远端配置参数)
-(void)getAllConfigWithRemoteAndLocalSuccessBlock:(SystemConfigSuccessBlock)successBlock
                   failureBlock:(SystemConfigFailureBlock)failureBlock;

@end

NS_ASSUME_NONNULL_END
